using System.Linq;

using DDD.Domain.Interfaces;
using DDD.Domain.Models;
using DDD.Infra.Data.Context;

using Microsoft.EntityFrameworkCore;

namespace DDD.Infra.Data.Repository;

public class CustomerRepository : Repository<Customer>, ICustomerRepository
{
    public CustomerRepository(ApplicationDbContext context)
        : base(context)
    {
    }

    public Customer GetByEmail(string email)
    {
        return _dbSet.AsNoTracking().FirstOrDefault(c => c.Email == email);
    }
}
